bitkeeper revision 1.571 (3fabc0ccIidm1y01SeueL9ZtLe3myA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 7 Nov 2003 15:57:00 +0000 (15:57 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 7 Nov 2003 15:57:00 +0000 (15:57 +0000)
setup.c, xl_vbd.c, memory.c, process.c:
  Various fixes. One to SCSI code in xenolinux, others to suspend/resume (which is still a bit broken).

xen/arch/i386/process.c
xen/common/memory.c
xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c
xenolinux-2.4.22-sparse/arch/xeno/kernel/setup.c

index 4dc4b43e03783466c2f1ba3dc6f2451149252c79..4f7d16d761f0528a22aad2b8b7750db01cd46027 100644 (file)
@@ -249,6 +249,8 @@ void switch_to(struct task_struct *prev_p, struct task_struct *next_p)
      */
     if ( (stack_ec->cs & 3) == 0 )
         stack_ec->cs = FLAT_RING1_CS;
+    if ( (stack_ec->ss & 3) == 0 )
+        stack_ec->ss = FLAT_RING1_DS;
 
     unlazy_fpu(prev_p);
 
index 8d33bd9f2088448621c099e35e158dfe3fe9357b..0eb478c6ee92066cd55df3e53262f145178a8647 100644 (file)
 #include <asm/uaccess.h>
 #include <asm/domain_page.h>
 
-#if 0
+#if 1
 #define MEM_LOG(_f, _a...) printk("DOM%d: (file=memory.c, line=%d) " _f "\n", current->domain, __LINE__, ## _a )
 #else
 #define MEM_LOG(_f, _a...) ((void)0)
@@ -274,7 +274,6 @@ int map_ldt_shadow_page(unsigned int off)
         for ( i = 0; i < 512; i++ )
             if ( unlikely(!check_descriptor(ldt_page[i*2], ldt_page[i*2+1])) )
                 goto out;
-
         if ( unlikely(page->flags & PG_need_flush) )
         {
             perfc_incrc(need_flush_tlb_flush);
@@ -479,7 +478,6 @@ static int get_l1_table(unsigned long page_nr)
         if ( unlikely(ret) ) goto fail;
     }
 
- out:
     /* Make sure we unmap the right page! */
     unmap_domain_mem(p_l1_entry-1);
     return ret;
index 7a25020b3934b3e08cd66efe99db19a601a8d043..7037576d16b8d946e809f9170a43728d8749d131 100644 (file)
@@ -33,7 +33,7 @@ struct gendisk *xlvbd_gendisk[XLVBD_MAX_MAJORS] = { NULL };
 #define XLIDE_PARTN_SHIFT  6    /* amount to shift minor to get 'real' minor */
 #define XLIDE_MAX_MINORS  (1 << XLIDE_PARTN_SHIFT)     /* minors per ide vbd */
 
-#define XLSCSI_PARTN_SHIFT 6    /* amount to shift minor to get 'real' minor */
+#define XLSCSI_PARTN_SHIFT 4    /* amount to shift minor to get 'real' minor */
 #define XLSCSI_MAX_MINORS (1 << XLSCSI_PARTN_SHIFT)   /* minors per scsi vbd */
 
 #define XLVBD_PARTN_SHIFT  6    /* amount to shift minor to get 'real' minor */
@@ -230,11 +230,13 @@ int __init xlvbd_init(xen_disk_info_t *xdi)
               hence using unit number for now but in old code was 'disk' aka 
               sequence number assigned by xen during probe = barfle? */
            ((xl_disk_t *)gd->real_devices)[minor>>gd->minor_shift].capacity =
-           xdi->disks[i].capacity;
+                xdi->disks[i].capacity;
 
            
            /* remember that we've done this major */
            majors[major] = 1; 
+       } else {
+           gd = get_gendisk(device); 
        }
 
        if(XD_READONLY(xdi->disks[i].info)) 
index 22366631207674b1570fc4c23f0356a454066429..7cb888f2d545946118fbd7239d0253425e407199 100644 (file)
@@ -1086,12 +1086,24 @@ static void stop_task(void *unused)
         pfn_to_mfn_frame_list[j++] = 
             virt_to_machine(&phys_to_machine_mapping[i]) >> PAGE_SHIFT;
 
+    /*
+     * NB. This is /not/ a full dev_close() as that loses route information!
+     * Instead we do essentialy the same as dev_close() but without notifying
+     * various registered subsystems about the NETDEV_DOWN event.
+     */
     rtnl_lock();
     for ( i = 0; i < 10; i++ )
     {
         sprintf(name, "eth%d", i);
-        if ( (dev = __dev_get_by_name(name)) != NULL )
-            dev_close(dev);
+        if ( ((dev = __dev_get_by_name(name)) != NULL) &&
+             (dev->flags & IFF_UP) )
+        {
+            dev_deactivate(dev);
+            clear_bit(__LINK_STATE_START, &dev->state);
+            if ( dev->stop != NULL )
+                dev->stop(dev);
+            dev->flags &= ~IFF_UP;
+        }
     }
     rtnl_unlock();
 
@@ -1116,12 +1128,28 @@ static void stop_task(void *unused)
 
     blkdev_resume();
 
+    /*
+     * We now do the opposite of the network suspend code. Basically it's
+     * dev_open() but without notifying anyone about NETDEV_UP.
+     */
     rtnl_lock();
     for ( i = 0; i < 10; i++ )
     {
         sprintf(name, "eth%d", i);
-        if ( (dev = __dev_get_by_name(name)) != NULL )
-            dev_open(dev);
+        if ( ((dev = __dev_get_by_name(name)) != NULL) &&
+             !(dev->flags & IFF_UP) )
+        {
+            set_bit(__LINK_STATE_START, &dev->state);
+            if ( (dev->open == NULL) || (dev->open(dev) == 0) )
+            {
+                dev->flags |= IFF_UP;
+                dev_activate(dev);
+            }
+            else
+            {
+                clear_bit(__LINK_STATE_START, &dev->state);
+            } 
+        }
     }
     rtnl_unlock();